<?php
namespace Controller;

use Hoa\Registry\Registry;
use Library\Log;
use Library\View;
use Requests;


/**
 * HttpController
 * @author los_gsy
 */
class HttpController extends BaseController {
	/**
	 * 构造函数
	 */
	public function __construct() {
		parent::__construct();
	}


	/**
	 * test
	 */
	public function test() {
		echo __METHOD__, '<br />';
	}


	/**
	 * http server
	 */
	public function server() {
		$conf = Registry::get('conf');
		$ret = $conf['status'][200];
		exit(json_encode($ret));
	}


	/**
	 * http client
	 */
	public function client() {
		//http接口参数
		$url = 'http://www.mpf.lab/Http/server';
		$header = ['Accept' => 'application/json'];
		$option = [];
		$resp = Requests::get($url, $header, $option);
		var_dump($resp);
		$result = json_decode($resp->body, true);
		var_dump($result);
	}


}